﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class payrelease : System.Web.UI.Page
{
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString.ToString());
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            if (Session["name"] == null)
            {
                Response.Redirect("login.aspx");
            }
        }
        
    }
    protected void ImageButton4_Click(object sender, ImageClickEventArgs e)
    {
        int i = Convert.ToInt32(yxdate.Text.Trim());

        string sqlstr = "insert into chargeinfo (type,title,info,linkman,tel,showday,show) values ('" + DropDownList1.Text + "','" + title.Text.Trim() + "','" + info.Text.Trim() + "','" + linkman.Text.Trim() + "','" + tel.Text.Trim() + "','" + DateTime.Now.AddDays(i).ToString("yyyy-MM-dd") + "','" + CheckBox1.Checked + "')";
        SqlCommand comm = new SqlCommand(sqlstr, conn);
        conn.Open();
        if (Convert.ToInt32(comm.ExecuteNonQuery()) > 0)
        {
            Response.Write("<script>alert('信息发布成功！')</script>");
        }
        else
        {
            Response.Write("<script>alert('信息发布失败！')</script>");
        }
        conn.Close();
    }
}